*	************************************************************************
* 	File-Name: 		TablesA21-A22.do
*	Log-file:		----JOP_tablea2122_logfiles.log
*
*	Author: 		Aycan Katitas
*
*	Data Used:  	anesoutlierjobs.dta
*
*	Purpose:   		.do file for estimating Table A8 in Appendix
*	
*   Date Updated: July 2024
*	************************************************************************

clear
set more off

cd "/Users/aycankatitas/Desktop/Git/chinagfdi"


****************************************************************************
**Table A21: Chinese GFDI and Threat Perceptions: Removing Chinese Greenfield FDI Jobs Outliers
****************************************************************************


use "data/anesoutlierjobs.dta", clear
quietly do "codebook/vars_codebook.do"

local indcont nationalism education econoutlook party age gender i.race
local distcont unemploy_ivbase_d per_manu_ivbase_d perchinese_ivbase_d medinc_ivbase_d_log
local f i.sample_state i.year
local y chinaect
qui{
ivreg2 `y' `indcont' `distcont' `f' (chinajobsiv_d_log= zjobs_log), partial(i.sample_state) cluster(sample_state)
eststo out1
estadd local state "Yes", replace
estadd local year "Yes", replace 
}


esttab out1 using output/table21.tex, b(3) se(3) wrap label noomitted nobaselevels noconstant replace parentheses stats(N state year, fmt(%7.0fc)  labels("Observations" "State Fixed Effects" "Year Fixed Effects"))  ///
drop(*.year) ///
	booktabs nonotes nogaps compress ///
	starlevels( * 0.10 ** 0.05 *** 0.010) ///
	nomtitle mgroups("China Threat == 1", pattern(1 0 0 0)  ///
	prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
	title("Chinese GFDI and Threat Perceptions: Removing Chinese Greenfield FDI Jobs Outliers")
	


****************************************************************************
**Table A22: Chinese GFDI and Threat Perceptions: Removing Chinese Greenfield FDI Value Outliers
****************************************************************************


use "data/anesoutlierval.dta", clear
quietly do "codebook/vars_codebook.do"

local indcont nationalism education econoutlook party age gender i.race
local distcont unemploy_ivbase_d per_manu_ivbase_d perchinese_ivbase_d medinc_ivbase_d_log
local f i.sample_state i.year
local y chinaect
qui{
ivreg2 `y' `indcont' `distcont' `f' (chinavaliv_d_log= zval_log), partial(i.sample_state) cluster(sample_state)
eststo out1
estadd local state "Yes", replace
estadd local year "Yes", replace 
}


esttab out1 using output/table22.tex, b(3) se(3) wrap label noomitted nobaselevels noconstant replace parentheses stats(N state year, fmt(%7.0fc)  labels("Observations" "State Fixed Effects" "Year Fixed Effects"))  ///
drop(*.year) ///
	booktabs nonotes nogaps compress ///
	starlevels( * 0.10 ** 0.05 *** 0.010) ///
	nomtitle mgroups("China Threat == 1", pattern(1 0 0 0)  ///
	prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) ///
	title("Chinese GFDI and Threat Perceptions: Removing Chinese Greenfield FDI Value Outliers")
	
